//package dsk.demo.product;
//
//
//import cn.hutool.http.HttpUtil;
//import cn.hutool.json.JSONUtil;
//import cn.hutool.poi.excel.ExcelReader;
//import cn.hutool.poi.excel.ExcelUtil;
//import cn.hutool.poi.excel.ExcelWriter;
//import lombok.Data;
//
//import java.io.File;
//import java.util.*;
//
//public class 东原后台价格爬取 {
//    private static final String  baseHighfilUrl = "dongyuan.sooparts.com/ProductSvr/BatchSearch_1";
//
//    public static void main(String[] args) {
//        File file = new File("C:\\Users\\Administrator\\Desktop\\oilFilterProd.xls");
//        File filePrice = new File("C:\\Users\\Administrator\\Desktop\\oilFilterPrice.xls");
//        ExcelWriter writer = ExcelUtil.getWriter(filePrice);
//
//        ExcelReader reader = ExcelUtil.getReader(file);
//        List<Product> products = reader.readAll(Product.class);
//        for (Product product : products) {
//            Product price = getPrice(product.getProductNo());
//            System.out.println(price);
//            writer.writeRow(price,false);
//            writer.flush();
//        }
//    }
//
//    private static Product getPrice(String productNo) {
//        Map<String,Object> parms = new HashMap<>();
//        parms.put("mfaStr","0");
//        parms.put("mfaStr1","0");
//        String tempData = "[\" {data}\"]";
//        parms.put("data",tempData.replaceAll("\\{data\\}",productNo));
//        String content = HttpUtil.createPost(baseHighfilUrl)
//                .header("Cookie", "UserName=t2; Password=highfil2022; IsRemember=True; security_session_verify=ce73b20bec1e75863ab7fdd1c5c9934e; ASP.NET_SessionId=q5qarmpgvtf3eph4iygae0ty")
//                .header("Content-Type","application/json")
//                .body(JSONUtil.toJsonStr(parms))
//                .execute().body();
//        String s = content.replaceAll("\\\\u000d\\\\u000a", "").replaceAll("\\\\","");
//        String substring = s.substring(1, s.length());
//        List<Map> maps = JSONUtil.toList(substring, Map.class);
//        Product product = new Product();
//        product.setProductNo(productNo);
//        for (Map map : maps) {
//            if (map.get("EPL_ImagePath").equals("图片")) {
//                continue;
//            }
//            product.getPriceSet().add((String)map.get("EPL_PRICE"));
//            product.getPriceSet().add((String)map.get("EPL_PRICE_A"));
//            product.getPriceSet().add((String)map.get("EPL_PRICE_B"));
//            product.getPriceSet().add((String)map.get("EPL_PRICE_C"));
//        }
//        return product;
//    }
//
//
//    @Data
//    public static class Product{
//        //产品编号
//        private String productNo;
//        //价格集合
//        private Set<String> priceSet = new HashSet<>();
//
//    }
//}